home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / def / DefConnection.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  2.4 KB  |  85 lines

  1. package asp.wizard.def;
  2.  
  3. public class DefConnection extends DefAbstract {
  4.    public static final int DBTYPE_INVALID = -1;
  5.    public static final int DBTYPE_ODBC_MSACCESS = 0;
  6.    public static final int DBTYPE_ODBC_MSSQLSERVER = 1;
  7.    public static final int DBTYPE_ODBC_OTHER = 2;
  8.    private int _odbcType;
  9.    private String _dsnName;
  10.    private String _userName;
  11.    private String _password;
  12.    private int _globalConnection;
  13.  
  14.    public DefConnection() {
  15.    }
  16.  
  17.    public DefConnection(DefConnection aDefConnection) {
  18.       this.setEqualConnectionTo(aDefConnection);
  19.       this._globalConnection = aDefConnection._globalConnection;
  20.    }
  21.  
  22.    public void setEqualConnectionTo(DefConnection aDefConnection) {
  23.       this._odbcType = aDefConnection._odbcType;
  24.       this._dsnName = aDefConnection._dsnName;
  25.       this._userName = aDefConnection._userName;
  26.       this._password = aDefConnection._password;
  27.    }
  28.  
  29.    public void setOdbcType(int odbcType) {
  30.       switch (odbcType) {
  31.          case 0:
  32.          case 1:
  33.             this._odbcType = odbcType;
  34.             break;
  35.          default:
  36.             this._odbcType = -1;
  37.       }
  38.  
  39.    }
  40.  
  41.    public void setDSNName(String dSN) {
  42.       this._dsnName = new String(dSN);
  43.    }
  44.  
  45.    public void setUserName(String userName) {
  46.       this._userName = new String(userName);
  47.    }
  48.  
  49.    public void setPassword(String password) {
  50.       this._password = new String(password);
  51.    }
  52.  
  53.    public void setGlobalConnection(int globalConnection) {
  54.       this._globalConnection = globalConnection;
  55.    }
  56.  
  57.    public int getOdbcType() {
  58.       return this._odbcType;
  59.    }
  60.  
  61.    public String getDSNName() {
  62.       return this._dsnName;
  63.    }
  64.  
  65.    public String getUserName() {
  66.       return this._userName;
  67.    }
  68.  
  69.    public String getPassword() {
  70.       return this._password;
  71.    }
  72.  
  73.    public int getGlobalConnection() {
  74.       return this._globalConnection;
  75.    }
  76.  
  77.    public String getBaseName() {
  78.       return "MSDBConnection";
  79.    }
  80.  
  81.    public boolean equalConnectionTo(DefConnection otherConnection) {
  82.       return this._odbcType == otherConnection.getOdbcType() && this._dsnName.equals(otherConnection.getDSNName()) && this._userName.equals(otherConnection.getUserName()) && this._password.equals(otherConnection.getPassword());
  83.    }
  84. }
  85.